Fix navbar user-specific balances - #307
Conversation
|
@Codekill33 is attempting to deploy a commit to the Threadflow Team on Vercel. A member of the Team first needs to authorize it. |
|
@Codekill33 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughBoth navbar components now derive ChangesNavbar Auth Session Wiring
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@components/global-navbar.tsx`:
- Line 147: The CreditBalance component is falling through to a 0 badge when
userId is undefined, so signed-out users are shown as having credits instead of
the empty state. Add an explicit empty-state guard in CreditBalance (for example
in the component in components/reputation/credit-balance.tsx) so it returns
nothing or the signed-out state before reaching the data?.balance ?? 0 fallback,
while keeping global-navbar.tsx passing userId through as-is.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 196a2c55-5151-42aa-b680-3c57cf8c6b8f
📒 Files selected for processing (2)
components/global-navbar.tsxcomponents/ui/global-resizable-navbar.tsx
Benjtalkshow
left a comment
There was a problem hiding this comment.
Thanks, the swap from "user-1" to session-derived userId is right, but CI will fail on pnpm tsc --noEmit:
components/global-navbar.tsx(147,26): error TS2322: Type 'string | undefined' is not assignable to type 'string'.
components/ui/global-resizable-navbar.tsx(45,26): error TS2322: Type 'string | undefined' is not assignable to type 'string'.
CreditBalance declares userId: string (required) but receives string | undefined. The cleanest fix is to update components/reputation/credit-balance.tsx to accept userId?: string and add if (!userId) return null; at the top, matching what NavRankBadge already does. Also please attach a screenshot of the navbar while signed in (rank badge + credit balance visible) and while signed out (empty state) so I can verify the visual result, and consider using a feature branch instead of pushing from your fork's main next time.
|
Fixed in b69df60. |
Summary
Fixes the navbar rank badge and credit balance so they use the authenticated user's session ID instead of the hardcoded
user-1placeholder.Changes
authClient.useSession()userIdfromsession?.user?.iduserIdtoNavRankBadgeandCreditBalanceCreditBalanceto the resizable navbar variantuser-1Verification
user-1references remain in:components/global-navbar.tsxcomponents/ui/global-resizable-navbar.tsxgit diff --checkpassedNote: Full lint could not be run locally because
eslintwas not available in the checkout.closes #272
Summary by CodeRabbit